<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * post_system
 *
 * Description
 *
 * @author Simon Emms <simon@simonemms.com>
 * @since 30-Jan-2012
 */

class post_system {
    
    
    
    /**
     * Close DB
     * 
     * Closes all the DB connections
     */
    public function close_db() {
        $objCI = &get_instance();
        
        if(class_exists('CI_DB') AND isset($objCI->db)) {
            if(is_array($objCI->db)) {
                /* Close each database connection */
                $arrDb = $objCI->db;
                if(count($arrDb) > 0) {
                    foreach($arrDb as $objDb) {
                        $objDb->close();
                    }
                }
            } else {
                /* Just close it */
                $objCI->db->close();
            }
            
            /* Unset the db so it doesn't run the close at the end of the CI class */
            unset($objCI->db);
        }
    }
    
    
    
}
?>